﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RooHui.Infrastructure.Entities.Repository;

namespace RooHui.Infrastructure.Entities.Entity
{
    public class County : IAccessible<P_County, County>, ILogicEntity<P_County, County>
    {
        public string CountyCode { get; set; }

        public string CountyName { get; set; }

        public string CityCode { get; set; }

        protected override void Covariant(P_County model)
        {
            if (model != null)
            {
                this.CountyCode = model.CountyCode;
                this.CityCode = model.CityCode;
                this.CountyName = model.CountyName;
            }
        }

        protected override P_County Inverter(County model)
        {
            if (model != null)
            {
                return new P_County()
                {
                    CountyCode = model.CountyCode,
                    CountyName = model.CountyName,
                    CityCode = model.CityCode

                };
            }
            return null;
        }

        public County Set(P_County dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
